<template>
	
    <!-- pages/index/myMessage.wxml -->
    <view class="weui-cells demo_badge_cells">
		<navigator url="/pages/partner/square/square" >
			<uni-nav-bar title="前往广场" right-icon="right" height="70rpx" ></uni-nav-bar>
		</navigator>
        <view aria-labelledby="js_a11y_nt js_a11y_comma js_a11y_nb" class="weui-cell weui-cell_active weui-cell_access" aria-role="link" v-for="(item, index) in list" :key="index">
            <view class="weui-cell__hd" :aria-hidden="true">
                <image :src="item.portrait" style="height: 100rpx; width: 100rpx"></image>
            </view>

            <view class="weui-cell__bd" :aria-hidden="true" id="b1_txt1" style="margin-left: 15rpx">
                <text>{{ item.nickname }}</text>
            </view>

            <view @tap="goMsgDetail" :data-title="item">
                <text class="weui-cell__ft" :aria-hidden="true" id="b3_n2">查看空间</text>
            </view>
        </view>
		<view style="float: right;">
			<uni-fab ref="fab" :pattern="pattern" 
			@fabClick="fabClick" />
	
		</view>
		
	
    </view>
</template>

<script>
// pages/index/myMessage.js
export default {
    data() {
        return {
			pageNum:1,
            list: [
                
            ]
        };
		
    }
    /**
     * Lifecycle function--Called when page load
     */,
    onLoad: function (options) {
		//this.userid = uni.getStorage(userId)
		console.log(this.userid)
		uni.request({
			url:this.$baseUrl + '/relationship/partner/id='+this.pageNum,
			method:'GET',
			header:{
				"session":"shadow-test",
				'Accept': 'application/json',
				"Content-Type":"application/json",
			},
			data:{
				
			},
			success: res=> {
				console.log(res)
				if(res.statusCode == 200){
					console.log(res.data.data)
					this.list = res.data.data
					
				}else{
					console.log("广场加载失败")
					uni.showToast({
					  title: res.data.errorCode,
					  icon: 'error',
					})
				}
				
			},
			fail :(e)=>{
				console.log(e)
			}
		})
	},
    /**
     * Lifecycle function--Called when page is initially rendered
     */
    onReady: function () {},
    /**
     * Lifecycle function--Called when page show
     */
    onShow: function () {},
    /**
     * Lifecycle function--Called when page hide
     */
    onHide: function () {},
    /**
     * Lifecycle function--Called when page unload
     */
    onUnload: function () {},
    /**
     * Page event handler function--Called when user drop down
     */
    onPullDownRefresh: function () {},
    /**
     * Called when page reach bottom
     */
    onReachBottom: function () {},
    /**
     * Called when user click on the top right corner to share
     */
    onShareAppMessage: function () {},
    methods: {
        goMsgDetail: function (e) {
            console.log(e);

            if (this.hasLogin) {
                uni.navigateTo({
                    url: e.currentTarget.dataset.url
                });
            } else {
                // var portrait = e.currentTarget.dataset.title.portrait;
                // var nickname = e.currentTarget.dataset.title.nickname;
				var id = e.currentTarget.dataset.title.id;
				console.log(id)
                uni.navigateTo({
                    url: '/pages/partner/space/space'
                });
            }
        },
		fabClick(){
			if (this.hasLogin) {
			    uni.navigateTo({
			        url: e.currentTarget.dataset.url
			    });
			} else {
			    // var portrait = e.currentTarget.dataset.title.portrait;
			    // var nickname = e.currentTarget.dataset.title.nickname;
			    uni.navigateTo({
			        url: '/pages/partner/invitation/invitation'
			    });
			}
		}
    }
};
</script>
<style>

</style>
